﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;

namespace MyBlog2.Models
{
    public class User
    {
        public User()
        {
            Avatar = "/images/admin.jpg";
            Articles = new HashSet<Article>();
        }

        [Key]
        public int Id{ get; set; }

        [Required(ErrorMessage = "{0}不能为空！")]
        [Display(Name = "用户名")]
        public string UserName { get; set; }

        [Required(ErrorMessage = "{0}不能为空！")]
        [Display(Name = "密码")]
        public string Password { get; set; }

        [Required]
        [Display(Name = "昵称")]
        public string Nickname { get; set; }

        [Required]
        [Display(Name = "邮箱")]
        [DataType(DataType.EmailAddress)]
        public string Email { get; set; }

        [Required]
        [Display(Name = "头像")]
        public string Avatar { get; set; }


        [Display(Name = "关于我")]
        public string AboutMe { get; set; }

        public virtual ICollection<Article> Articles { get; set; }

    }
}
